<div nz-row [nzGutter]="16">
  <div nz-col [nzMd]="24">
    <form nz-form [formGroup]="validateForm" >
      <nz-form-item>
        <nz-form-control [nzSm]="18" [nzXs]="24" style="text-align: center;">
          <nz-radio-group [nzButtonStyle]="'solid'" formControlName="questionType" [(ngModel)]="questionType">
            <label nz-radio-button nzValue="单选题">单选题</label>
            <label nz-radio-button nzValue="多选题">多选题</label>
            <label nz-radio-button nzValue="判断题">判断题</label>
            <label nz-radio-button nzValue="填空题">填空题</label>
            <label nz-radio-button nzValue="解答题">解答题</label>
            <label nz-radio-button nzValue="编程题">编程题</label>
          </nz-radio-group>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" >试题</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <!--<app-ueditor formControlName="content"></app-ueditor>-->
          <textarea nz-input formControlName="content" [nzAutosize]="{ minRows: 5, maxRows: 10 }"></textarea>
        </nz-form-control>
      </nz-form-item>

      <h1 style="text-align: center;">答案选项</h1>
      <nz-form-item *ngIf="questionType=='单选题'||questionType=='多选题'">
        <nz-form-label [nzSm]="4" [nzXs]="24" >(A)</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="choiceA" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item *ngIf="questionType=='单选题'||questionType=='多选题'">
        <nz-form-label [nzSm]="4" [nzXs]="24" >(B)</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="choiceB" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item *ngIf="questionType=='单选题'||questionType=='多选题'">
        <nz-form-label [nzSm]="4" [nzXs]="24" >(C)</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="choiceC" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item *ngIf="questionType=='单选题'||questionType=='多选题'">
        <nz-form-label [nzSm]="4" [nzXs]="24" >(D)</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="choiceD" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item *ngIf="(questionType=='单选题'&&E)||(questionType=='多选题'&&E)">
        <nz-form-label [nzSm]="4" [nzXs]="24" >(E)</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="choiceE" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item *ngIf="(questionType=='单选题'&&F)||(questionType=='多选题'&&F)">
        <nz-form-label [nzSm]="4" [nzXs]="24" >(F)</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="choiceF" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item *ngIf="(questionType=='单选题'&&G)||(questionType=='多选题'&&G)">
        <nz-form-label [nzSm]="4" [nzXs]="24" >(G)</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="choiceG" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item *ngIf="(questionType=='单选题'&&H)||(questionType=='多选题'&&H)">
        <nz-form-label [nzSm]="4" [nzXs]="24" >(H)</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="choiceH" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>

      <div style="text-align: center;" *ngIf="questionType=='单选题'||questionType=='多选题'">
        <a *ngIf="choiceNum>=8" disabled (click)="addChoice()">添加选项</a>
        <a *ngIf="choiceNum<8" (click)="addChoice()">添加选项</a>
        <nz-divider nzType="vertical"></nz-divider>
        <a *ngIf="choiceNum<=4" disabled (click)="deleteChoice()">删除选项</a>
        <a *ngIf="choiceNum>4" (click)="deleteChoice()">删除选项</a>
      </div>

      <nz-form-item *ngIf="questionType=='单选题'">
        <nz-form-label [nzSm]="4" [nzXs]="24" >正确答案</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <nz-radio-group formControlName="answer">
            <label nz-radio nzValue="A">A</label>
            <label nz-radio nzValue="B">B</label>
            <label nz-radio nzValue="C">C</label>
            <label nz-radio nzValue="D">D</label>
            <label *ngIf="E" nz-radio nzValue="E">E</label>
            <label *ngIf="F" nz-radio nzValue="F">F</label>
            <label *ngIf="G" nz-radio nzValue="G">G</label>
            <label *ngIf="H" nz-radio nzValue="H">H</label>
          </nz-radio-group>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item *ngIf="questionType=='多选题'">
        <nz-form-label [nzSm]="4" [nzXs]="24" >正确答案</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <nz-checkbox-wrapper style="width: 100%;" (nzOnChange)="changeAnswer($event)">
            <label nz-checkbox nzValue="A">A</label>
            <label nz-checkbox nzValue="B">B</label>
            <label nz-checkbox nzValue="C">C</label>
            <label nz-checkbox nzValue="D">D</label>
            <label *ngIf="E" nz-checkbox nzValue="E">E</label>
            <label *ngIf="F" nz-checkbox nzValue="F">F</label>
            <label *ngIf="G" nz-checkbox nzValue="G">G</label>
            <label *ngIf="H" nz-checkbox nzValue="H">H</label>
          </nz-checkbox-wrapper>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item *ngIf="questionType=='判断题'">
        <nz-form-label [nzSm]="4" [nzXs]="24" >正确答案</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <nz-radio-group formControlName="answer">
            <label nz-radio nzValue="1">真</label>
            <label nz-radio nzValue="0">假</label>
          </nz-radio-group>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item *ngIf="questionType=='填空题'">
        <nz-form-label [nzSm]="4" [nzXs]="24" >正确答案</nz-form-label>
        <!--<span>多个填空答案中间用“&&&&&”分隔</span>-->
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="answer" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item *ngIf="questionType=='解答题'||questionType=='编程题'">
        <nz-form-label [nzSm]="4" [nzXs]="24" >正确答案</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="answer" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" >题目解析</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <textarea nz-input formControlName="description" [nzAutosize]="{ minRows: 2, maxRows: 6 }"></textarea>
        </nz-form-control>
      </nz-form-item>
      <!--<nz-form-item>-->
        <!--<nz-form-label [nzSm]="4" [nzXs]="24" >试题分数</nz-form-label>-->
        <!--<nz-form-control [nzSm]="18" [nzXs]="24">-->
          <!--<nz-input-number formControlName="score" [nzMin]="1"  [nzStep]="1"></nz-input-number>-->
        <!--</nz-form-control>-->
      <!--</nz-form-item>-->

      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" >试题难度</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <nz-radio-group formControlName="difficulty" [nzButtonStyle]="'solid'">
            <label nz-radio-button nzValue="简单">简单</label>
            <label nz-radio-button nzValue="较难">较难</label>
            <label nz-radio-button nzValue="很难">很难</label>
          </nz-radio-group>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label [nzSm]="4" [nzXs]="24" >考核内容分类</nz-form-label>
        <nz-form-control [nzSm]="18" [nzXs]="24">
          <nz-tree-select style="width: 250px"
                          nzPlaceHolder="请选择"
                          [nzDropdownMatchSelectWidth]="true"
                          [nzDropdownStyle]="{ 'max-height': '300px' }"
                          formControlName="knowledgeId"
                          [nzNodes]="searchOptions"
                          [nzAsyncData]="true"
                          (onModelChange)="getKnowledgeByPid(0)"
                          (nzExpandChange)="onExpandChange($event)">
          </nz-tree-select>
          <nz-divider nzType="vertical"></nz-divider>
          <button nz-button [nzType]="'primary'" (click)="addKnowledge()">{{'添加分类' | translate}}</button>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item nz-row style="margin-bottom:8px;" *ngIf="_id==undefined">
        <nz-form-control [nzSpan]="14" [nzOffset]="21">
          <button nz-button class="login-form-button" [nzLoading]="!isCheck" (click)="addSubmit()" nzType="primary">提交</button>
        </nz-form-control>
      </nz-form-item>

    </form>
  </div>
</div>
